package com.boarsoft.boar.batch.demo.flow;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.boarsoft.boar.batch.demo.entity.Demo1;
import com.boarsoft.flow.core.bean.ProcessHandler;
import com.boarsoft.hibernate.biz.SimpleBizImpl;
import com.boarsoft.hibernate.dao.SimpleDao;

public class DemoFlowBatchProcess5 extends SimpleBizImpl implements ProcessHandler {
	@Autowired
	protected SimpleDao dao;

	/**
	 * 从demo1中删除
	 */
	@SuppressWarnings("unchecked")
	@Override
	public Object process(String entry, Object data, Throwable throwable) throws Throwable {
		Map<String, Object> pm = (Map<String, Object>) data;
		List<Demo1> lt = (List<Demo1>) pm.get("list");
		dao.batchDelete(lt, lt.size());
		// for (Demo1 o : lt) {
		// dao.delete(o);
		// }
		return data;
	}
}
